package com.hsc.yalebao.tabIndex;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.google.gson.Gson;
import com.hsc.yalebao.base.ActivityStack;
import com.hsc.yalebao.base.BaseActivity;
import com.hsc.yalebao.base.CustomApplication;
import com.hsc.yalebao.base.MainActivity;
import com.hsc.yalebao.http.AppConstants;
import com.hsc.yalebao.http.RequestNet;
import com.hsc.yalebao.model.BaseDataObject;
import com.hsc.yalebao.model.RoomListBaseBean;
import com.hsc.yalebao.model.RoomListBean;
import com.hsc.yalebao.model.UserBaseBean;
import com.hsc.yalebao.tools.SystemHelper;
import com.hsc.yalebao.tools.UiUtil;
import com.hsc.yalebao.weight.LogUtils;
import com.hsc.yalebao.weight.MyDialog1;
import com.hsc.yalebao.weight.NewMyOddsPopuWindow;
import com.zhy.http.okhttp.callback.StringCallback;
import java.util.ArrayList;
import java.util.HashMap;
import okhttp3.Call;

@SuppressLint({"NewApi"})
public class DaTingActivity extends BaseActivity
  implements View.OnClickListener
{
  private String TAG = "DaTingActivity";
  private double chujimin;
  private View contentView;
  private Context context;
  private double gaojimin;
  String highLotteryId;
  String highRoomId;
  private ImageView iv_title_right;
  private LinearLayout lin_rooms;
  private String lotteryid;
  private TextView mChujiDesTv;
  private ImageView mChujiPeilvView;
  private TextView mChujiTv;
  private TextView mGaojiDesTv;
  private ImageView mGaojiPeilvView;
  private TextView mGaojiTv;
  private TextView mZhongjiDesTv;
  private ImageView mZhongjiPeilvView;
  private TextView mZhongjiTv;
  String middleLotteryId;
  String middleRoomId;
  private MyDialog1 myDialog1;
  private NewMyOddsPopuWindow newMyOddsPopuWindow;
  View.OnClickListener onClickListener = new View.OnClickListener()
  {
    public void onClick(View paramAnonymousView)
    {
      switch (paramAnonymousView.getId())
      {
      case 2131099704:
      default:
        return;
      case 2131099699:
      }
      CustomApplication.app.finishActivity(DaTingActivity.this);
    }
  };
  private String parentid;
  String primaryLotteryId;
  String primaryRoomId;
  private RelativeLayout rel_high;
  private RelativeLayout rel_middle;
  private RelativeLayout rel_primary;
  private int screenHeight = 0;
  private TextView tv_high_people_count;
  private TextView tv_middle_people_count;
  private TextView tv_primary_people_count;
  private View view_title;
  private double zhongjimin;

  private void getIsEnterRoom(final int paramInt, String paramString)
  {
    HashMap localHashMap = new HashMap();
    boolean bool = CustomApplication.app.isLogin;
    int i = 0;
    if (bool)
    {
      UserBaseBean localUserBaseBean = CustomApplication.app.userBaseBean;
      i = 0;
      if (localUserBaseBean != null)
        i = CustomApplication.app.userBaseBean.getMemberid();
    }
    localHashMap.put("memberid", i);
    localHashMap.put("roomid", paramString);
    localHashMap.put("client_Ip", CustomApplication.app.NetIP);
    LogUtils.i(this.TAG, "memberId:" + i);
    LogUtils.i(this.TAG, "roomId:" + paramString);
    showLoadingDialog();
    LogUtils.i(this.TAG, "getIsEnterRoom()-URL:" + AppConstants.URL_GET_ISENTERROOM);
    RequestNet.get(this.context, AppConstants.URL_GET_ISENTERROOM, localHashMap, new StringCallback()
    {
      public void onError(Call paramAnonymousCall, Exception paramAnonymousException)
      {
        DaTingActivity.this.dismissLoadingDialog();
        LogUtils.e(DaTingActivity.this.TAG, "获取失败,getParent2RoomListInfo-result:" + paramAnonymousException);
      }

      public void onResponse(String paramAnonymousString)
      {
        DaTingActivity.this.dismissLoadingDialog();
        LogUtils.d(DaTingActivity.this.TAG, "result:" + paramAnonymousString);
        if (paramAnonymousString.isEmpty())
        {
          LogUtils.d(DaTingActivity.this.TAG, "s.isEmpty");
          return;
        }
        Gson localGson = new Gson();
        try
        {
          localBaseDataObject = (BaseDataObject)localGson.fromJson(paramAnonymousString, BaseDataObject.class);
          if (localBaseDataObject == null)
          {
            LogUtils.e(DaTingActivity.this.TAG, "获取失败");
            return;
          }
        }
        catch (Exception localException)
        {
          BaseDataObject localBaseDataObject;
          while (true)
          {
            localException.printStackTrace();
            localBaseDataObject = null;
          }
          if (localBaseDataObject.getFlag() == -4)
          {
            DaTingActivity.activityStack.backToMain(MainActivity.class, DaTingActivity.this.context);
            return;
          }
          if (localBaseDataObject.getFlag() == 0)
          {
            DaTingActivity.this.ShowDialog1(localBaseDataObject.getMsg());
            return;
          }
          if (localBaseDataObject.getFlag() == -2)
          {
            DaTingActivity.this.showDownWireDialog();
            return;
          }
          switch (paramInt)
          {
          default:
            return;
          case 2131099811:
            Intent localIntent3 = new Intent(DaTingActivity.this, RoomListActivity.class);
            localIntent3.putExtra("parentid", DaTingActivity.this.primaryRoomId);
            localIntent3.putExtra("lotteryid", DaTingActivity.this.primaryLotteryId);
            LogUtils.i(DaTingActivity.this.TAG, "primaryRoomId:" + DaTingActivity.this.primaryRoomId);
            LogUtils.i(DaTingActivity.this.TAG, "primaryLotteryId:" + DaTingActivity.this.primaryLotteryId);
            DaTingActivity.this.startActivity(localIntent3);
            return;
          case 2131099817:
          case 2131099823:
          }
        }
        Intent localIntent2 = new Intent(DaTingActivity.this, RoomListActivity.class);
        localIntent2.putExtra("parentid", DaTingActivity.this.middleRoomId);
        localIntent2.putExtra("lotteryid", DaTingActivity.this.middleLotteryId);
        LogUtils.i(DaTingActivity.this.TAG, "middleRoomId:" + DaTingActivity.this.middleRoomId);
        LogUtils.i(DaTingActivity.this.TAG, "middleLotteryId:" + DaTingActivity.this.middleLotteryId);
        DaTingActivity.this.startActivity(localIntent2);
        return;
        Intent localIntent1 = new Intent(DaTingActivity.this, RoomListActivity.class);
        localIntent1.putExtra("parentid", DaTingActivity.this.highRoomId);
        localIntent1.putExtra("lotteryid", DaTingActivity.this.highLotteryId);
        LogUtils.i(DaTingActivity.this.TAG, "highRoomId:" + DaTingActivity.this.highRoomId);
        LogUtils.i(DaTingActivity.this.TAG, "highLotteryId:" + DaTingActivity.this.highLotteryId);
        DaTingActivity.this.startActivity(localIntent1);
      }
    });
  }

  private void getParent1RoomListInfo()
  {
    HashMap localHashMap = new HashMap();
    localHashMap.put("parentID", this.parentid);
    localHashMap.put("lottery_id", this.lotteryid);
    LogUtils.i(this.TAG, "getParent1RoomListInfo()()-lotteryid:" + this.lotteryid);
    showLoadingDialog();
    RequestNet.get(this.context, AppConstants.URL_GET_ROOMBYPARENTID, localHashMap, new StringCallback()
    {
      public void onError(Call paramAnonymousCall, Exception paramAnonymousException)
      {
        DaTingActivity.this.dismissLoadingDialog();
        LogUtils.e(DaTingActivity.this.TAG, "获取失败,getParent1RoomListInfo-result:" + paramAnonymousException);
      }

      public void onResponse(String paramAnonymousString)
      {
        LogUtils.d(DaTingActivity.this.TAG, "result:" + paramAnonymousString);
        DaTingActivity.this.dismissLoadingDialog();
        if (paramAnonymousString.isEmpty());
        ArrayList localArrayList;
        do
        {
          RoomListBean localRoomListBean;
          do
          {
            return;
            Gson localGson = new Gson();
            try
            {
              localRoomListBean = (RoomListBean)localGson.fromJson(paramAnonymousString, RoomListBean.class);
              if (localRoomListBean == null)
              {
                LogUtils.e(DaTingActivity.this.TAG, "获取失败");
                return;
              }
            }
            catch (Exception localException)
            {
              while (true)
              {
                localException.printStackTrace();
                localRoomListBean = null;
              }
              if (localRoomListBean.getFlag() == -4)
              {
                DaTingActivity.activityStack.backToMain(MainActivity.class, DaTingActivity.this.context);
                return;
              }
              if (localRoomListBean.getFlag() == -2)
              {
                DaTingActivity.this.showDownWireDialog();
                return;
              }
              if (localRoomListBean.getFlag() == -3)
              {
                DaTingActivity.this.ShowFengjinDialog();
                return;
              }
              if (localRoomListBean.getFlag() == 0)
              {
                UiUtil.showToast(DaTingActivity.this.context, localRoomListBean.getMsg());
                return;
              }
            }
          }
          while (localRoomListBean.getFlag() != 1);
          localArrayList = localRoomListBean.getResult();
        }
        while ((localArrayList == null) || (localArrayList.size() <= 0));
        int i = 0;
        label221: RoomListBaseBean localRoomListBaseBean;
        String str1;
        String str2;
        int j;
        int k;
        int m;
        int n;
        if (i < localArrayList.size())
        {
          localRoomListBaseBean = (RoomListBaseBean)localArrayList.get(i);
          if (localRoomListBaseBean != null)
          {
            str1 = localRoomListBaseBean.getTitle();
            str2 = localRoomListBaseBean.getContent();
            j = localRoomListBaseBean.getOnline_num();
            k = localRoomListBaseBean.getId();
            m = localRoomListBaseBean.getRoom_level();
            n = localRoomListBaseBean.getLottery_id();
            if (m != 1)
              break label432;
            DaTingActivity.this.tv_primary_people_count.setText(j + "人");
            DaTingActivity.this.primaryRoomId = k;
            DaTingActivity.this.primaryLotteryId = n;
            DaTingActivity.this.chujimin = localRoomListBaseBean.getMin_money();
            DaTingActivity.this.mChujiTv.setText(str1);
            DaTingActivity.this.mChujiDesTv.setText("(" + str2 + ")");
          }
        }
        while (true)
        {
          i++;
          break label221;
          break;
          label432: if (m == 2)
          {
            DaTingActivity.this.tv_middle_people_count.setText(j + "人");
            DaTingActivity.this.middleRoomId = k;
            DaTingActivity.this.middleLotteryId = n;
            DaTingActivity.this.zhongjimin = localRoomListBaseBean.getMin_money();
            DaTingActivity.this.mZhongjiTv.setText(str1);
            DaTingActivity.this.mZhongjiDesTv.setText("(" + str2 + ")");
          }
          else if (m == 3)
          {
            DaTingActivity.this.tv_high_people_count.setText(j + "人");
            DaTingActivity.this.highRoomId = k;
            DaTingActivity.this.highLotteryId = n;
            DaTingActivity.this.gaojimin = localRoomListBaseBean.getMin_money();
            DaTingActivity.this.mGaojiTv.setText(str1);
            DaTingActivity.this.mGaojiDesTv.setText("(" + str2 + ")");
          }
        }
      }
    });
  }

  private void init()
  {
    this.mChujiPeilvView = ((ImageView)findViewById(2131099813));
    this.mZhongjiPeilvView = ((ImageView)findViewById(2131099819));
    this.mGaojiPeilvView = ((ImageView)findViewById(2131099825));
    this.mChujiPeilvView.setOnClickListener(this);
    this.mZhongjiPeilvView.setOnClickListener(this);
    this.mGaojiPeilvView.setOnClickListener(this);
    this.myDialog1 = new MyDialog1(this.context);
    String str = "游戏级别";
    if ("1".equals(this.lotteryid))
      str = "北京28";
    while (true)
    {
      setTitle(8, 0, 2130837809, str, 0, 8, 8, 0, true);
      this.lin_rooms = ((LinearLayout)this.contentView.findViewById(2131099810));
      this.rel_primary = ((RelativeLayout)this.contentView.findViewById(2131099811));
      this.rel_middle = ((RelativeLayout)this.contentView.findViewById(2131099817));
      this.rel_high = ((RelativeLayout)this.contentView.findViewById(2131099823));
      Bitmap localBitmap = BitmapFactory.decodeResource(getResources(), 2130837971);
      int i = localBitmap.getWidth();
      int j = localBitmap.getHeight() * getResources().getDisplayMetrics().widthPixels / i;
      ViewGroup.LayoutParams localLayoutParams = this.rel_primary.getLayoutParams();
      localLayoutParams.height = j;
      this.rel_primary.setLayoutParams(localLayoutParams);
      this.rel_middle.setLayoutParams(localLayoutParams);
      this.rel_high.setLayoutParams(localLayoutParams);
      this.rel_primary.setOnClickListener(this);
      this.rel_middle.setOnClickListener(this);
      this.rel_high.setOnClickListener(this);
      this.tv_primary_people_count = ((TextView)this.contentView.findViewById(2131099816));
      this.tv_middle_people_count = ((TextView)this.contentView.findViewById(2131099822));
      this.tv_high_people_count = ((TextView)this.contentView.findViewById(2131099828));
      this.mChujiTv = ((TextView)this.contentView.findViewById(2131099814));
      this.mChujiDesTv = ((TextView)this.contentView.findViewById(2131099815));
      this.mZhongjiTv = ((TextView)this.contentView.findViewById(2131099820));
      this.mZhongjiDesTv = ((TextView)this.contentView.findViewById(2131099821));
      this.mGaojiTv = ((TextView)this.contentView.findViewById(2131099826));
      this.mGaojiDesTv = ((TextView)this.contentView.findViewById(2131099827));
      return;
      if ("3".equals(this.lotteryid))
        str = "加拿大28";
    }
  }

  public void onClick(View paramView)
  {
    switch (paramView.getId())
    {
    default:
      return;
    case 2131099811:
      if (!SystemHelper.isConnected(this.context))
      {
        UiUtil.showToast(this.context, "请检查您的网络");
        return;
      }
      getIsEnterRoom(2131099811, this.primaryRoomId);
      return;
    case 2131099817:
      if (!SystemHelper.isConnected(this.context))
      {
        UiUtil.showToast(this.context, "请检查您的网络");
        return;
      }
      getIsEnterRoom(2131099817, this.middleRoomId);
      return;
    case 2131099823:
      if (!SystemHelper.isConnected(this.context))
      {
        UiUtil.showToast(this.context, "请检查您的网络");
        return;
      }
      getIsEnterRoom(2131099823, this.highRoomId);
      return;
    case 2131099813:
      this.newMyOddsPopuWindow = new NewMyOddsPopuWindow(this.context, this.primaryRoomId, 0);
      this.newMyOddsPopuWindow.show(this.contentView);
      return;
    case 2131099819:
      this.newMyOddsPopuWindow = new NewMyOddsPopuWindow(this.context, this.middleRoomId, 0);
      this.newMyOddsPopuWindow.show(this.contentView);
      return;
    case 2131099825:
    }
    this.newMyOddsPopuWindow = new NewMyOddsPopuWindow(this.context, this.highRoomId, 0);
    this.newMyOddsPopuWindow.show(this.contentView);
  }

  public void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    this.context = this;
    this.contentView = LayoutInflater.from(this.context).inflate(2130903053, null);
    this.screenHeight = CustomApplication.app.displayMetrics.heightPixels;
    setContentView(this.contentView);
    CustomApplication.app.addActivity(this);
    Bundle localBundle = getIntent().getExtras();
    if (localBundle != null)
    {
      if (localBundle.containsKey("parentid"))
        this.parentid = localBundle.getString("parentid");
      if (localBundle.containsKey("lotteryid"))
        this.lotteryid = localBundle.getString("lotteryid");
    }
    LogUtils.i(this.TAG, "parentid:" + this.parentid);
    LogUtils.i(this.TAG, "lotteryid:" + this.lotteryid);
    init();
  }

  public void onDestroy()
  {
    super.onDestroy();
  }

  public void onResume()
  {
    super.onResume();
    getParent1RoomListInfo();
  }

  @SuppressLint({"NewApi"})
  public void setTitle(int paramInt1, int paramInt2, int paramInt3, String paramString, int paramInt4, int paramInt5, int paramInt6, int paramInt7, boolean paramBoolean)
  {
    View localView = findViewById(2131099716);
    if (paramBoolean)
      localView.setVisibility(0);
    while (true)
    {
      TextView localTextView1 = (TextView)localView.findViewById(2131099701);
      localTextView1.setText(paramString);
      localTextView1.setText(paramString);
      ((TextView)localView.findViewById(2131099700)).setVisibility(paramInt1);
      ImageView localImageView = (ImageView)localView.findViewById(2131099699);
      localImageView.setVisibility(paramInt2);
      localImageView.setOnClickListener(this.onClickListener);
      localImageView.setImageResource(paramInt3);
      TextView localTextView2 = (TextView)localView.findViewById(2131099702);
      localTextView2.setVisibility(paramInt5);
      localTextView2.setOnClickListener(this.onClickListener);
      this.iv_title_right = ((ImageView)localView.findViewById(2131099704));
      this.iv_title_right.setVisibility(paramInt6);
      this.iv_title_right.setOnClickListener(this.onClickListener);
      this.iv_title_right.setImageResource(paramInt7);
      return;
      localView.setVisibility(8);
    }
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.hsc.yalebao.tabIndex.DaTingActivity
 * JD-Core Version:    0.6.2
 */